home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 2205 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.3 KB  |  49 lines

  1. Newsgroups: comp.lang.c
  2. Path: durham.org!cschmidt
  3. From: cschmidt@freenet.durham.org (Chris Schmidt)
  4. Subject: Re: What should be returned?
  5. X-Newsreader: TIN [version 1.2 PL2]
  6. Sender: news@freenet.durham.org (news)
  7. Nntp-Posting-Host: freenet.durham.org
  8. Organization: Durham Free-Net
  9. Message-ID: <DLEvrv.K85@freenet.durham.org>
  10. References: <4dj8pv$cjd@eng_ser1.erg.cuhk.hk>
  11. Date: Fri, 19 Jan 1996 04:43:07 GMT
  12.  
  13. the CAReLess boy (phsung@cs.cuhk.hk) wrote:
  14. : Hi, all,
  15.  
  16. :     It's said that the function main must return an integer value
  17. : but I just don't know what value should be returned.  Also, if I quit
  18. : main by exit(), what's the use of the return value?
  19.  
  20. :     Any help?
  21.  
  22. I myself am just starting to learn this stuff too, but from what I have 
  23. read so far.. if you do not require an exit value from the program use:
  24.  
  25. void main(void)
  26.  
  27. Otherwise you might want your program to return a status code that might 
  28. be used to determined if it has executed properly without errors.  Then 
  29. you would use:
  30.  
  31. int main()
  32. {
  33. stuf.....
  34.  
  35. return (stat_code);
  36. }
  37.  
  38. or something similar.
  39.  
  40. You C gurus out there can correct me if I am wrong on this..I AM just a 
  41. rookie and don't want to get into the bad habits this soon  ;-)
  42.  
  43.  
  44. --
  45. -------------------------------------------
  46. Chris Schmidt
  47. cschmidt@freenet.durham.org
  48. -------------------------------------------
  49.